package com.bgs.travelapp.scenicRank.service.Impl;

import com.bgs.travelapp.result.CommonResult;
import com.bgs.travelapp.scenic.entity.ScenicEntity;
import com.bgs.travelapp.scenic.mapper.ScenicMapper;
import com.bgs.travelapp.scenicRank.entity.ScenicRankEntity;
import com.bgs.travelapp.scenicRank.mapper.ScenicRankMapper;
import com.bgs.travelapp.scenicRank.service.ScenicRankService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 前端---景区排行
 * gpd 2022-08-23 08点41分
 */
@Service
public class ScenicRankServiceImpl implements ScenicRankService {

    @Resource
    ScenicRankMapper scenicRankMapper;


    /**
     * 查询景区排行
     * 前端---景区排行
     * gpd 2022-08-23 08点40分
     *
     * @return
     */
    @Override
    public CommonResult getRanking() {
        List<ScenicRankEntity> scenicRankEntities = scenicRankMapper.selectScenicRankCollection();
        List<ScenicRankEntity> select = scenicRankMapper.selectScenicRankTravelVolume();
        Map<Object,Object> map = new HashMap<>();
        map.put("scenicRankCollection",scenicRankEntities);
        map.put("travelVolume",select);
        return CommonResult.ok(map);
    }
}
